<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function addUser($name, $email, $username, $password) {
	mysql_query("INSERT INTO user (name, email, username, password) VALUES ('".$name."','".$email."','".$username."',md5('".$password."'));");
}

function updateUser($id, $name, $email, $username, $password) {
	mysql_query("UPDATE user set name = '".$name."', email = '".$email."', username = '".$username."', password = '".$password."' WHERE id = $id");
}

function login($email, $password) {
	
}

function confirm($id) {
	mysql_query("UPDATE user set confirm = 1 WHERE md5(id) = '".$id);
}

function bann($id) {
	mysql_query("UPDATE user set banned = 1 where id = $id");
}

function setUserType($id, $type, $endDate) {
	mysql_query("UPDATE user set userTypeId = '".$type."', endDate = $endDate");
}

function getUserData($id) {
	return mysql_fetch_array(mysql_query("SELECT * FROM user WHERE id = $id"));
}

function getUserMoney($id) {
	$array = mysql_fetch_array(mysql_query("SELECT money FROM user WHERE id = $id"));
	return $array[0];
}

function setUserMoney($id, $money) {
	mysql_query("UPDATE user set money = $money WHERE id = $id");
}
?>
